home *** CD-ROM | disk | FTP | other *** search
- unit SpellInt;
- {-interface unit for SPELLER.DLL}
- interface
- uses
- SysUtils, WinProcs, Classes;
-
- const
- MaxSuggest = 10; {don't change this!!!}
-
- function dllOpenDictionary(FileName : string) : Boolean;
- {-Opens the specified dictionary; Returns TRUE if successful}
- function dllInDictionary(AWord: String) : Boolean;
- {-Returns TRUE if AWord is in the dictionary}
- function dllAddWord(AWord : String) : Boolean;
- {-Adds AWord to User Dictionary; Returns TRUE if successful}
- function dllSuggestWords(AWord: String; NumSuggest: byte): TStringList;
- {-Suggests words; Returns nil if unsuccessful}
- procedure dllDeleteUserWords;
- {-Deletes all word in User Dictionary}
- procedure dllCloseDictionary;
- {-Closes the currently open dictionary}
-
- implementation
-
- function Changer (S: String): String;
- {-changes the word for use by the dictionary}
- var
- i: integer;
- CWord: String;
- ch: Char;
- begin
- S := S + #0;
- {AnsiToOem (@S[1], @S[1]);}
- {make a copy of the word}
- CWord := S;
- {blank the word to receive the changed word, since it is a variable}
- S := '';
- {rebuild the word ready for the dictionary}
- for i := 1 to (length(Cword)) do
- begin
- ch := Cword[i];
- {case of accented a,e,i,o,u,u,n,N. Using ASCII #.}
- case ch of
- #160 : S := S + 'a' + '/';
- #130 : S := S + 'e' + '/';
- #161 : S := S + 'i' + '/';
- #162 : S := S + 'o' + '/';
- #163 : S := S + 'u' + '/';
- #129 : S := S + 'u' + '*';
- #164 : S := S + 'n' + '/';
- #165 : S := S + 'n' + '*';
- 'a'..'z','A'..'Z', '''' : S := S + CH;
- end; { case }
- end; { next i }
- S := UpperCase (S);
- Result := S;
- end; {changer}
-
- type
- StrsType = String[30];
- ShortList = Array [1..MaxSuggest] of StrsType;
-
- function _OpenDictionary (FileName : string) : Boolean;
- Far; External 'SPELLER' index 1;
- function _InDictionary (AWord : String) : Boolean;
- Far; External 'SPELLER' index 2;
- function _AddWord(AWord: String; Sorted : Boolean) : Boolean;
- Far; External 'SPELLER' index 3;
- procedure _SuggestWords(AWord: String; var SW: ShortList; NumSuggest: byte);
- Far; External 'SPELLER' index 4;
- procedure _DeleteUserWords;
- Far; External 'SPELLER' index 5;
- procedure _CloseDictionary;
- Far; External 'SPELLER' index 6;
- function _Changer (S: String): String;
- Far; External 'SPELLER' index 7;
- function _AdjustCase (S, PictureSt: String): string;
- Far; External 'SPELLER' index 8;
- procedure _Simulate(var S : String; DNewstr : string);
- Far; External 'SPELLER' index 9;
-
- function dllOpenDictionary(FileName : string) : Boolean;
- {-Opens the specified dictionary; Returns TRUE if successful}
- begin
- Result := _OpenDictionary (FileName);
- end; { dllOpenDictionary }
-
- function dllInDictionary(AWord: String) : Boolean;
- {-Returns TRUE if AWord is in the dictionary}
- begin
- AWord := Changer (AWord);
- Result := _InDictionary (AWord);
- end; { dllInDictionary }
-
- function dllAddWord(AWord : String) : Boolean;
- {-Adds AWord to User Dictionary; Returns TRUE if successful}
- begin
- AWord := Changer (AWord);
- Result := _AddWord (AWord, FALSE);
- end; { dllAddWord }
-
- function dllSuggestWords(AWord: String; NumSuggest: byte): TStringList;
- {-Suggests words; Returns nil if unsuccessful}
- var
- Listing: ShortList;
- i: byte;
- begin
- Result := TStringList.Create;
- _SuggestWords (AWord, Listing, NumSuggest);
- for i := 1 to NumSuggest do
- if Listing[i]<>'' then
- Result.Add (_AdjustCase (Listing[i], AWord));
- end; { dllSuggestWords }
-
- procedure dllDeleteUserWords;
- {-Deletes all word in User Dictionary}
- begin
- _DeleteUserWords;
- end; { dllDeleteUserWords }
-
- procedure dllCloseDictionary;
- {-Closes the currently open dictionary}
- begin
- _CloseDictionary;
- end; { dllCloseDictionary }
-
- end. { SpellInt }
-